<template>
  <!--工时月报-->
  <div>
    <el-form :inline="true" class="demo-form-inline">
      <el-form-item label="筛选查询">
      </el-form-item>
      <el-form-item label="项目">
        <el-select v-model="GetWorkLogByDayParam.projectId" placeholder="项目名称">
          <el-option v-for="(project) in projects" :label="project.projectName" :key="project.projectId"
                     :value="project.projectId"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="  登记时间">
        <el-date-picker
            v-model="GetWorkLogByDayParam.createTimeStart"
            type="datetime"
            placeholder="选择开始日期时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="~">
        <el-date-picker
            v-model="GetWorkLogByDayParam.createTimeEnd"
            type="datetime"
            placeholder="选择结束日期时间">
        </el-date-picker>
      </el-form-item>


      <el-form-item>
        <el-button type="primary" @click="getWorkLogByDay()">查询</el-button>
      </el-form-item>
    </el-form>

    <el-table
        :data="workLogs"
        border
        style="width: 100%">


      <el-table-column
          prop="projectName"
          label="项目名称"
          width="120">
      </el-table-column>
      <el-table-column
          prop="modifyTime"
          label="登记时间"
          width="120">
      </el-table-column>
      <el-table-column
          prop="modifyPerson"
          label="登记人"
          width="120">
      </el-table-column>

      <el-table-column
          prop="hours"
          label="登记工时"
          width="300">
      </el-table-column>


    </el-table>
  </div>
</template>

<script>
export default {
  name: "monthly",
  data() {
    return {
      GetWorkLogByMothParam: {
        createTimeStart: null,
        createTimeEnd: null,
        pageIndex: 1,
        pageSize: 99
      },
      projects:[],
      workLogs:[],
      allWorks:[],
    }

  },
  methods:{
    getProjects(){
      this.$http.post("/project/findAllProject", this.findProjectParam)
          .then(resp => {
            console.log("getProjects===================");
            console.log(resp);
            this.projects = resp.data.data.projects;
          })
    },
    getWorkLogByDay(){
      console.log("workLogs===================");
      this.$http.post("/workLog/getWorkLogListByMoth", this.GetWorkLogByDayParam)
          .then(resp => {
            console.log(resp.data.data);
            var Biglist = resp.data.data;
            for(var i=0;i< Biglist.length;i++){
              for(var j=0 ;j<Biglist[i].length;j++){
                this.workLogs.push(Biglist[i][j]);
              }
            }
            console.log(this.workLogs);
          })
    },
    getAll(){

      this.$http.get("/workLog/getAll")
          .then(resp => {
            console.log("getAll============");
            console.log(resp.data.data);
           this.workLogs=resp.data.data;
          })
    }
  },
  created() {
    this.getProjects();

    this.getAll();
  },


}


</script>

<style scoped>

</style>